﻿CREATE TABLE [dbo].[UserRole] (
    [UserRoleId] INT IDENTITY (1, 1) NOT NULL,
    [UserId]     INT NOT NULL,
    [RoleId]     INT NOT NULL,
    CONSTRAINT [PK__UserRole__AF2760AD6477ECF3] PRIMARY KEY CLUSTERED ([UserRoleId] ASC),
   CONSTRAINT [FK_UserRole_ToTable1] FOREIGN KEY ([UserId]) REFERENCES [EnterpriseUser]([UserId]),
   CONSTRAINT [FK_UserRole_ToTable2] FOREIGN KEY ([RoleId]) REFERENCES [Roles]([RoleId])

);


GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_UserRole]
    ON [dbo].[UserRole]([RoleId] ASC, [UserId] ASC);

